package text;

import java.io.File;
import java.io.FileFilter;

public class Test06 {
    public static void main(String[] args) {
        File file = new File(".");
        if (file.isDirectory()) {//判断是列表还是文件
            FileFilter filter = new FileFilter() {
                public boolean accept(File pathname) {
                    String name = pathname.getName();
                    return name.contains("s");//contains字符串中包含s字母的
                }
            };
            File[] subs = file.listFiles(filter);
            for (File sub :subs){
                System.out.println(sub.getName());
            }
        }
    }
}
